<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content='text/html; charset=UTF-8'/>
    <script src="../src/jPlex.js" type="text/javascript" charset="utf-8"></script>

</head>
<body>
<script type="text/javascript">


    jPlex.include("jplex.xprototype.*");
    jPlex.include("jplex.common.DataSource");

    var ds1 = new DataSource(DataSource.TYPE_ARRAY, ["pif", "paf", "pouf"], null, {
        process: function(data) {
            console.log("Data from JS Array");
            console.log(data);
        }
    });
    ds1.request();

    var s2 = "pif.paf.pouf";
    var ds2 = new DataSource(DataSource.TYPE_FUNCTION, s2.split.bind(s2).curry("."), null, {
        process: function(data) {
            console.log("Data from Function");
            console.log(data);
        }
    });
    ds2.request();

    var ds3 = new DataSource(DataSource.TYPE_JSON, "datasource.json", {
        root:"['nestedData'].data",
        properties: [{key:"C1", path:"['obj']['[nested]'].renested[0]"}, "C2", "C3"]
    }, {
        process: function(data) {
            console.log("Data from JSON");
            console.log(data.pluck("C1"));
        }
    });
    ds3.request();

    var ds4 = new DataSource(DataSource.TYPE_XML, "datasource.xml", {
        properties: [{key:"C1", path:"nested[0]/C1[2]@value"}, "C2", "C3"]
    }, {
        poll: true,
        pollInterval: 5,
        lifetime: 12,
        cache:true,

        process: function(data) {
            console.log("Data from XML");
            console.log(data.pluck("C1"));
        }
    });
    ds4.request();


</script>
</body>
</html>